package com.yjhh.chdataservice.controller;

import org.apache.commons.lang.StringUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2018/2/27.
 */
public class BaseControler {

    /**
     * 获取发送请求的客户机IP
     *
     * @param request
     * @return
     */
    String getRemortIP(HttpServletRequest request) {
        if (StringUtils.isBlank(request.getHeader("x-forwarded-for"))) {
            return request.getRemoteAddr();
        }
        return request.getHeader("x-forwarded-for");
    }

}
